package net.dopan.pigframe.user.model.dto;

import lombok.Data;
import net.dopan.pigframe.core.model.MenuVO;

/**
 * @Package: net.dopan.pigframe.user.model.dto
 * @Title: MenuTree
 * @Description:
 * @author: 刘宽
 * @date: 2018/9/2 20:30
 */
@Data
public class MenuTree extends TreeNode {

    private String icon;

    private String name;

    private String url;

    private boolean spread = false;

    private String path;

    private String component;

    private String authority;

    private String redirect;

    private String code;

    private String type;

    private String label;

    private Integer sort;

    public MenuTree() {
    }

    public MenuTree(int id, String name, int parentId) {
        this.id = id;
        this.parentId = parentId;
        this.name = name;
        this.label = name;
    }

    public MenuTree(int id, String name, MenuTree parent) {
        this.id = id;
        this.parentId = parent.getId();
        this.name = name;
        this.label = name;
    }

    public MenuTree(MenuVO menuVo) {
        this.id = menuVo.getMenuId();
        this.parentId = menuVo.getParentId();
        this.icon = menuVo.getIcon();
        this.name = menuVo.getName();
        this.url = menuVo.getUrl();
        this.path = menuVo.getPath();
        this.component = menuVo.getComponent();
        this.type = menuVo.getType();
        this.label = menuVo.getName();
        this.sort = menuVo.getSort();
    }
}
